//
//  RequireInfoView.m
//  SSB
//
//  Created by Lyn on 16/9/24.
//  Copyright © 2016年 TNT. All rights reserved.
//
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define ScreenScale (ScreenWidth / 375.f)

#import "RequireInfoView.h"
#import "UIView+PFAddtion.h"
#import "UIColor+GDBAddtion.h"
@interface RequireInfoView ()

@property (nonatomic, weak) UIImageView *icon;

@property (nonatomic, weak) UILabel *titleLabel;

@property (nonatomic, weak) UILabel *containLabel;

@end


@implementation RequireInfoView

- (instancetype) initWithIconName:(NSString *)iconName titleName:(NSString *)titleName containStr:(NSString *)containStr {
    if (self = [super init]) {
        UIImageView *icon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:iconName]];
        icon.frame = CGRectMake(16.f * ScreenScale, 16.f * ScreenScale, 17.5f , 17.5f );
        icon.contentMode = UIViewContentModeScaleAspectFill;
        [self addSubview:icon];
        self.icon = icon;
        
        UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(icon.right + 8.f * ScreenScale, 16.f + 5.f, 60.f, 12.f)];
        titleLabel.font = [UIFont systemFontOfSize:12.f];
        titleLabel.text = titleName;
        [titleLabel sizeToFit];
        titleLabel.centerY = icon.centerY;
        titleLabel.textColor = [UIColor pf_colorWithHexString:@"#333333"];
        [self addSubview:titleLabel];
        self.titleLabel = titleLabel;
        
        UILabel *containLabel = [[UILabel alloc]initWithFrame:CGRectMake(titleLabel.right + 5.f * ScreenScale, 16.f + 5.f, ScreenWidth, 12.f)];
        containLabel.font = [UIFont fontWithName:@"STHeitiSC-Light" size:12.f];
        containLabel.text = containStr;
        [containLabel sizeToFit];
        containLabel.centerY = titleLabel.centerY;
        containLabel.textColor = [UIColor pf_colorWithHexString:@"#888888"];
        [self addSubview:containLabel];
        self.titleLabel = containLabel;

        UIView *viewLine = [[UIView alloc]initWithFrame:CGRectMake(0.f, 51.f, ScreenWidth, 1.f)];
        viewLine.backgroundColor = [UIColor pf_colorWithHexString:@"f7f7f7"];
        [self addSubview:viewLine];
        
    }
    return self;
}

- (void)setIconName:(NSString *)iconName {
    _iconName = iconName;
    self.icon.image = [UIImage imageNamed:iconName];
}

- (void)setTitleStr:(NSString *)titleStr {
    _titleStr = titleStr;
    self.titleLabel.text = titleStr;
}

- (void)setContainStr:(NSString *)containStr {
    _containStr = containStr;
    self.containLabel.text = containStr;
}

@end
